home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-04 | 2.9 KB | 116 lines | [TEXT/KAHL] |
- /********************************************************* DEFINITION
- DATE: 9/28/93
- AUTHOR: Eric R. Rosé
-
- CLASS: CPPZoneList
-
- SUPERCLASS: CPPVisualStrList
-
- This C++ class manages a list of zone name strings
-
- ********************************************************************/
-
- #pragma once
-
- #include "CPPZoneList.h"
- #include <CPPNodeInfo.h>
- #include <CPPStringList.h>
- #include <CPPDArray.h>
- #include <StringTools.h>
-
- /*-----------------------------------------------------------------*/
- /*--------------------------- GLOBALS -----------------------------*/
- /*-----------------------------------------------------------------*/
-
- extern RGBColor RGBWhite;
- extern StringPtr gZoneName;
-
- /*-----------------------------------------------------------------*/
- /*------------------------ PUBLIC METHODS -------------------------*/
- /*-----------------------------------------------------------------*/
-
- CPPZoneList::CPPZoneList (CPPWindow *theWindow, Rect *boundsRect,
- CPPDArray *coreData, Boolean ownsData) :
- CPPVisualStringList (theWindow, boundsRect,
- coreData, ownsData,
- TRUE, lOnlyOne, 14)
- {
-
- }
-
- /*-----------------------------------------------------------------*/
-
- CPPZoneList::~CPPZoneList (void)
- {
-
- }
-
- /*-----------------------------------------------------------------*/
-
- char *CPPZoneList::ClassName (void)
- {
- return "CPPZoneList";
- }
-
- /*-----------------------------------------------------------------*/
-
- CPPStringList *CPPZoneList::MakeListOfZones (void)
- /* copy all of the object's strings into a pure stringlist */
- {
- CPPStringList *TempList = new CPPStringList();
-
- if (TempList && this->coreData)
- {
- for (long i = 1; i <= GetNumItems(); i++)
- TempList->AppendItem(String2String((*this)[i]));
- }
-
- return TempList;
- }
-
- /*-----------------------------------------------------------------*/
-
- StringPtr CPPZoneList::operator[] (long getWhich)
- {
- CPPStringList *theList = (CPPStringList *)this->GetItsData();
-
- if (theList)
- return ((*theList)[getWhich]);
- else
- return NULL;
- }
-
- /*-----------------------------------------------------------------*/
- /*---------------------- PROTECTED METHODS ------------------------*/
- /*-----------------------------------------------------------------*/
-
- void CPPZoneList::DrawCellContents (long whichCell, Rect *itsFrame,
- Boolean selected)
- {
- long theIndex;
- StringPtr theName = NULL;
- GVarHandle CG = (GVarHandle)((CWindowPeek)
- (this->owningWindow))->port.grafVars;
-
- if (this->coreData)
- theName = (*this)[whichCell];
-
- if (this->InColorWindow() && selected)
- RGBBackColor ((&(**CG).rgbHiliteColor));
-
- if (theName)
- {
- if (PStrCmp (theName, gZoneName) == 0)
- TextFace(bold);
- TextBox(theName+1, *theName, itsFrame, teJustLeft);
- TextFace(0);
- }
-
- if (selected)
- if (InColorWindow())
- RGBBackColor (&RGBWhite);
- else
- InvertRect (itsFrame);
- }
-
-